

<?php
include 'db_helper.php';

function listItems() {
	echo "listItems();\n";
}

function getItem($item) {
	echo "getItem(".$item.");\n";
}

function addItem($item) {
	echo "addItem(".$item.");\n";
}

function updateItem($item,$newItem) {
	echo "updateItem(".$item.",".$newItem.");\n";
}

function deleteItem($item) {
	echo "deleteItem(".$item.");\n";
}

//list all buildings
function listBuildings() {
	$dbQuery = sprintf("SELECT id,name,address FROM building");
	$result = getDBResultsArray($dbQuery);
	header("Content-type:application/json");
	echo json_encode($result);
	//echo "listBuildings()\n";
	//error_log("buildings")
}


//list all classrooms for a building
function listBuildingClassroom($buildingID) {
	$dbQuery = sprintf("SELECT classroom_id FROM building_classroom WHERE building_id = '%s'",
		mysql_real_escape_string($buildingID)
	);
	$result = getDBResultsArray($dbQuery);
	header("Content-type:application/json");
	echo json_encode($result);
}


//list all zones for a classroom 
function listClassroomSeat($classroomID) {
	$dbQuery = sprintf("SELECT seat_id FROM classroom_zone WHERE classroom_id = '%s'",
		mysql_real_escape_string($classroomID)
	);
	$result = getDBResultsArray($dbQuery);
	header("Content-type:application/json");
	echo json_encode($result);
}

function listSeatAttributes($seatID) {
	$dbQuery = sprintf("SELECT seat_id, row, seatnum, haswifi, hasoutlet, hasview, hasac, status, stars FROM seat WHERE seat_id",
	mysql_real_escape_string($seatID)
	);
	$result = getDBResultsArray($dbQuery);
	header("Content-type:application/json");
	echo json_encode($result);
}




//remember to properly close all functions ying! jeez

?>


